package org.jrtaudio;

public class DeviceInfo
{
	static public final long RTAUDIO_SINT8 = 0x1;    // 8-bit signed integer.
	static public final long RTAUDIO_SINT16 = 0x2;   // 16-bit signed integer.
	static public final long RTAUDIO_SINT24 = 0x4;   // Lower 3 bytes of 32-bit signed integer.
	static public final long RTAUDIO_SINT32 = 0x8;   // 32-bit signed integer.
	static public final long RTAUDIO_FLOAT32 = 0x10; // Normalized between plus/minus 1.0.
	static public final long RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/minus 1.0.

	public boolean probed = false;
	public String name;		
	public int outputChannels = 0;  /*!< Maximum output channels supported by device. */
	public int inputChannels = 0;   /*!< Maximum input channels supported by device. */
	public int duplexChannels = 0;  /*!< Maximum simultaneous input/output channels supported by device. */
	public boolean isDefaultOutput = false;         /*!< true if this is the default output device. */
	public boolean isDefaultInput = false;          /*!< true if this is the default input device. */
	public int sampleRates[]; /*!< Supported sample rates (queried from list of standard rates). */
	public long nativeFormats = 0;  /*!< Bit mask of supported data formats. */ 

	/**
	 * Create a string representation of the device.
	 */
	public String str(){
		String s = "Device \"" + name + "\" probed "; 
		if (probed)
		{
			s += "successfully.\n";
			s += "It has " + outputChannels + " output, " + inputChannels + " input, and " + duplexChannels + " duplex channels.\n";
			if (isDefaultOutput)
				s += "It is the DEFAULT OUTPUT device.\n";
			if (isDefaultInput)
				s += "It is the DEFAULT INPUT device.\n";
			s += "Native data formats: \n";
			if ((RTAUDIO_SINT8&nativeFormats) != 0) s += "Signed 8-bit Integer\n";
			if ((RTAUDIO_SINT16&nativeFormats) != 0) s += "Signed 16-bit Integer\n";
			if ((RTAUDIO_SINT24&nativeFormats) != 0) s += "Lower 3 bytes of 32-bit signed integer\n";
			if ((RTAUDIO_SINT32&nativeFormats) != 0) s += "Signed 32-bit Integer\n";
			if ((RTAUDIO_FLOAT32&nativeFormats) != 0) s += "32-bit float in (-1,1)\n";
			if ((RTAUDIO_FLOAT64&nativeFormats) != 0) s += "64-bit float in (-1,1)\n";
			s += "Sample rates: ";
			for(int i=0;i<sampleRates.length;i++)
			{
				s += sampleRates[i] + " ";
			}
			s += "\n";				
		}
		else
			s += "unsuccessfully.\n";
		return s; 
	}
}